// pages/myPan/settings/index/index.js
import utils from '../../../templates/loader/loader.js'
import api from '../../../../api/api.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that=this
    wx.showLoading({
      mask:true
    })
    api.getUser({
      done: (user) => {
        wx.hideLoading()
        that.setData({
          userInfo: user
        })
      }, fail: (user) => {
        wx.hideLoading()
      }
    })
  },
  exitAccount: function () {
    wx.showModal({
      title: '提示',
      content: '确定退出账号？',
      confirmColor: "#e30c26",
      success: function (res) {
        if (res.confirm) {
          wx.clearStorage()
          setTimeout(function(){
            wx.navigateBack()
          },100)
        }
      }
    })

  }
})